<template>
  <div class="DSL-data">
    <div class="page-header">
      <span class="title-item">大数据分析</span>
    </div>
    <div class="page-body">
      <!--搜索条件框-->
      <div class="page-condition">
        <a-form layout="inline" :form="form" @submit="handleSubmit">
          <a-row style="display: flex;align-items: center;">
            <a-col :span="20">
              <a-form-item label="时间段" labelAlign="right">
                <a-date-picker
                  v-model="startValue"
                  :disabled-date="disabledStartDate"
                  show-time
                  format="YYYY-MM-DD HH:mm:ss"
                  placeholder="开始时间"
                  @openChange="handleStartOpenChange"
                />
                <span style="color:#9fb043">-</span>
                <a-date-picker
                  v-model="endValue"
                  :disabled-date="disabledEndDate"
                  show-time
                  format="YYYY-MM-DD HH:mm:ss"
                  placeholder="结束时间"
                  :open="endOpen"
                  @openChange="handleEndOpenChange"
                />
              </a-form-item>
              <a-button class="search btn-style__class">查询</a-button>
              <a-button class="search btn-style__class">切换图表</a-button>
            </a-col>
            <a-col :span="2" :offset="2">
              <span class="download-btn">
                <a-icon type="cloud-download" />导出数据
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </div>
    <div style="height:84%">
      <div style="height:96%">
        <dataechart></dataechart>
      </div>

      <div class="bottom-title">
        <p>XXX大数据分析</p>
      </div>
    </div>
  </div>
</template>

<script>
import dataechart from "../components/dataEcharts";
import moment from "moment";
import "moment/locale/zh-cn";
export default {
  name: "index",
  components: {
    dataechart,
  },
  data() {
    return {
      form: this.$form.createForm(this, {
        name: "horizontal_login",
      }),
      moment,
      startValue: null,
      endValue: null,
      endOpen: false,
    };
  },
  mounted() {
    this.$nextTick(() => {
      this.form.validateFields();
    });
  },
  watch: {
    startValue(val) {
      console.log("startValue", val);
    },
    endValue(val) {
      console.log("endValue", val);
    },
  },
  methods: {
    disabledStartDate(startValue) {
      const endValue = this.endValue;
      if (!startValue || !endValue) {
        return false;
      }
      return startValue.valueOf() > endValue.valueOf();
    },
    disabledEndDate(endValue) {
      const startValue = this.startValue;
      if (!endValue || !startValue) {
        return false;
      }
      return startValue.valueOf() >= endValue.valueOf();
    },
    handleStartOpenChange(open) {
      if (!open) {
        this.endOpen = true;
      }
    },
    handleEndOpenChange(open) {
      this.endOpen = open;
    },
    handleSubmit() {},
    onCheckboxChange() {},
  },
};
</script>
<style scoped src="../../../assets/style/warning.css"></style>
<style scoped src="./index.css">
</style>
